<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \frontend\models\SignupForm */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;

$this->title = 'Signup';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-signup">
    <h1><?= Html::encode($this->title) ?></h1>

    <p>Please fill out the following fields to signup:</p>

    <div class="row">
        <div class="col-lg-5">
            <?php $form = ActiveForm::begin(['id' => 'form-signup']); ?>

            <?=$form->field($model, 'provinces')->dropDownList(ArrayHelper::map(common\models\GlobalRegion::find()->where(['region_type'=>1])->asArray()->all(),'region_id','region_name'),
        [
        'style'=>'width:150px',
        'prompt'=>'请选择省',
        'onchange'=>'
            $.post("index.php?r=user/lists&id='.'"+$(this).val(),function(data){             
                 $("#user-citys").html("<option value=>请选择市</option>");
                 $("#user-countrys").html("<option value=>请选择县</option>");
                 $("#user-citys").append(data);
            });',
        ])->label('省份'); ?>

    <?=$form->field($model, 'citys')->dropDownList(ArrayHelper::map(common\models\GlobalRegion::find()->where(['region_type'=>2])->asArray()->all(),'region_id','region_name'),
        [
        'style'=>'width:150px',
        'prompt'=>'请选择市',
        'onchange'=>' $.post("index.php?r=user/lists&id='.'"+$(this).val(),function(data){
             $("#user-countrys").html("<option value=>请选择县</option>");
             $("#user-countrys").append(data);
        });',
        ])->label('市'); ?>

     <?=$form->field($model, 'countrys')->dropDownList(ArrayHelper::map(common\models\GlobalRegion::find()->where(['region_type'=>3])->asArray()->all(),'region_id','region_name'),
        [
        'style'=>'width:150px',
        'prompt'=>'请选择县',
        'onchange'=>'
            $.post("index.php?r=branches/lists&amp;id='.'"+$(this).val(),function(data){
               
            });',
        ])->label('区/县'); ?> 

                <div class="form-group">
                    <?= Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
                </div>

            <?php ActiveForm::end(); ?>
        </div>
    </div>
</div>
